﻿using UnityEngine;

namespace HEFramework
{
    public static class MapViewSystem
    {
        [EntitySystem]
        public class MapViewAwakeSystem : AwakeSystem<MapView>
        {
            protected override void Awake(MapView _self)
            {
                var rc = _self.GetSceneChild<ResourcesComponent>();
                if (rc == null)
                {
                    return;
                }

                var obj = rc.Assets.LoadAssetSyn<GameObject>("2d/prefabs/map", "Map", ResourceConfig.Extension.PREFAB);
                var gc = _self.AddChild<GameObjectComponent>();
                gc.GameObject = GameObject.Instantiate(obj);
                gc.GameObject.transform.position = Vector2.zero;
            }
        }
    }
}